package thread;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.Time;
import java.util.Scanner;
import java.util.Timer;

/**
 * Thread提供了一个静态方法:
 * static void sleep(lang ms)
 */
public class SleepDemo {
    public static void main(String[] args) throws IOException {
        System.out.println("请输入一个数字");

        //Scanner scan = new Scanner(System.in);
        //int num = scan.nextInt();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        int num = Integer.parseInt(line);

        for(;num>0;num--){
            System.out.println(num);
            try {
                Thread.sleep(1000);//毫秒
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

        System.out.println("时间到");
    }
}
